var studentDao =require("../dao/studentDao");

module.exports = {

  async showStudentInfoByPage({currentPage,pageSize}){
     //创建一个分页对象
     let page={};
     //封装当前页数
     page.currentPage =currentPage;
     //封装每页显示条数
     page.pageSize =pageSize;
     //封装要显示的数据
     await studentDao.getstudentsbyPage({currentPage,pageSize}).then(data=>{
        page.datas = data;   
     });
     //封装要总条数
     await studentDao.getTotalNums().then(data=>{
         //封装要总条数
        page.tatolNum = data;
        //封装总页数
        page.tatolPages = Math.ceil(data/pageSize);
     })

     return page;
   } 
}